package ProyectoX.Menu;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.BorderFactory;
import javax.swing.ImageIcon;

import javax.swing.JButton;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;

import javax.swing.WindowConstants;
import javax.swing.border.BevelBorder;

import ProyectoX.Main.ProyectoXMain;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class MenuPrincipal extends javax.swing.JFrame {
	private JButton botonClinkz;
	private JButton botonSven;
	private JLabel labelClinkz;
	private JLabel labelSPJ;
	private JLabel labelFondo;
	private JPanel panelFondo;
	private JLabel labelSven;

	private int PJ;
	
	public MenuPrincipal() {
		super();
		initGUI();
	}
	
	private void initGUI() {
		try {
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			this.setTitle("PROYECTO X : MENU");
			getContentPane().setLayout(null);
			{
				botonClinkz = new JButton();
				getContentPane().add(botonClinkz, "Center");
				botonClinkz.setBounds(16, 133, 105, 119);
				botonClinkz.setIcon(new ImageIcon(getClass().getClassLoader().getResource("ProyectoX/Imagenes/Clinkz.png")));
				botonClinkz.setBackground(new java.awt.Color(192,192,192));
				botonClinkz.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
				botonClinkz.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						BotonPJActionPerformed(evt);
					}
				});
			}
			{
				botonSven = new JButton();
				getContentPane().add(botonSven);
				botonSven.setBounds(211, 133, 105, 119);
				botonSven.setIcon(new ImageIcon(getClass().getClassLoader().getResource("ProyectoX/Imagenes/Sven.png")));
				botonSven.setBorder(BorderFactory.createEtchedBorder(BevelBorder.LOWERED));
				botonSven.addActionListener(new ActionListener() {
					public void actionPerformed(ActionEvent evt) {
						BotonPJActionPerformed(evt);
					}
				});
			}
			{
				labelClinkz = new JLabel();
				getContentPane().add(labelClinkz);
				labelClinkz.setBounds(16, 260, 105, 32);
				labelClinkz.setBackground(new java.awt.Color(128,0,128));
				labelClinkz.setOpaque(true);
				labelClinkz.setText("Clinkz");
				labelClinkz.setToolTipText("Personaje de velocidad y poder de ataque");
				labelClinkz.setHorizontalTextPosition(SwingConstants.CENTER);
				labelClinkz.setHorizontalAlignment(SwingConstants.CENTER);
				labelClinkz.setFont(new java.awt.Font("Eras Bold ITC",1,16));
			}
			{
				labelSven = new JLabel();
				getContentPane().add(labelSven);
				labelSven.setBounds(213, 260, 105, 32);
				labelSven.setForeground(new java.awt.Color(0,0,0));
				labelSven.setOpaque(true);
				labelSven.setBackground(new java.awt.Color(128,128,64));
				labelSven.setText("Sven");
				labelSven.setHorizontalAlignment(SwingConstants.CENTER);
				labelSven.setHorizontalTextPosition(SwingConstants.CENTER);
				labelSven.setFont(new java.awt.Font("Eras Bold ITC",1,16));
				labelSven.setToolTipText("Personaje de Resistencia extrema");
			}
			{
				labelSPJ = new JLabel();
				getContentPane().add(labelSPJ);
				labelSPJ.setText("Seleccion de personaje");
				labelSPJ.setBounds(16, 33, 300, 68);
				labelSPJ.setFont(new java.awt.Font("Berlin Sans FB Demi",1,26));
				labelSPJ.setHorizontalAlignment(SwingConstants.CENTER);
				labelSPJ.setHorizontalTextPosition(SwingConstants.CENTER);
				labelSPJ.setForeground(new java.awt.Color(255,255,255));
			}
			{
				panelFondo = new JPanel();
				getContentPane().add(panelFondo);
				panelFondo.setBounds(0, 0, 339, 308);
				{
					labelFondo = new JLabel();
					panelFondo.add(labelFondo);
					labelFondo.setSize(0, 0);
					labelFondo.setPreferredSize(new java.awt.Dimension(339, 308));
					labelFondo.setIcon(new ImageIcon(getClass().getClassLoader().getResource("ProyectoX/Imagenes/fondoMenu.jpg")));
				}
			}
			pack();
			this.setSize(359, 350);
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	
	/**
	 * Oyente De los botones de seleccion de personaje
	 * @param evt 
	 */
	private void BotonPJActionPerformed(ActionEvent evt) {
		if (evt.getSource() == botonClinkz){
			PJ = 1;
		}
		else if (evt.getSource() == botonSven){
			PJ = 2;
		}
		ProyectoXMain.asignarPJ(PJ);
		this.dispose();
	}

}
